package com.windaka.suizhi.utils;


import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

/**
 * 分页结果
 * @author wzk
 * @date 13:34 2022/2/18
**/
@ApiModel(value = "分页结果")
@Data
public class RetPage<T> implements Serializable {

    private static final long serialVersionUID = 1905122041950251207L;

    @ApiModelProperty(value = "页数", example = "1")
    private Integer page;

    @ApiModelProperty(value = "每页数量", example = "5")
    private Integer limit;

    @ApiModelProperty(value = "总数", example = "100")
    private Long total;

    @ApiModelProperty(value = "上一页", example = "1")
    private Integer prePage;

    @ApiModelProperty(value = "下一页", example = "2")
    private Integer nextPage;

    @ApiModelProperty(value = "返回数据", example = "[]")
    private List<T> result;

    /**
     * 静态方法 设置result值
     * @author wzk
     * @date 15:21 2022/2/18
    **/
    public static <T> RetPage<T> result(List<T> result) {
        RetPage<T> ret = new RetPage<>();
        ret.setResult(result);
        return ret;
    }

}
